package com.dave.admin.common.result;

import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Dave
 * @version 1.0
 */

public class PageConvert {

    /**
     * 自定义响应字段
     */
    public static Map buildResult(IPage iPage) {
        Map<String, Object> result = new HashMap<>();
        result.put("records", iPage.getRecords());
        result.put("total", iPage.getTotal());
        result.put("pageSize", iPage.getSize());
        result.put("pageIndex", iPage.getCurrent());
        return result;
    }
}
